package com.example.demo.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadTest4 {

    public static ExecutorService executorService = Executors.newFixedThreadPool(5);


    public static void main(String[] args) throws Exception {
        for (int i = 0; i < 10; i++) {
            int finalI = i;
            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(finalI + "Hello from Runnable" + Thread.currentThread().getName());
                }
            });
        }
    }
}
